import React, { Component } from 'react'

export default class Danxuan extends Component {
    render() {
        let obj = this.props.obj;
        return (
            <div style={{ display: obj.questionType === 'one' ? 'block' : 'none' }}>
                <div className="title">
                    <span>单选</span>
                    <section>{obj.title}</section>
                </div>
                <ul className="timu_list">
                    {
                        // 如果optionContent是一个字符串数组，name直接渲染
                        // 有时获取数据比较慢，而传值是很快的，这个时候会造成页面刷新时，转换不了
                        JSON.parse(obj.optionContent || "[]").map((item,index) => (
                            <li key={index}>
                                <i className="iconfont icon-normal"></i>
                                <section>{item.key}、{item.value}</section>
                            </li>
                        ))
                    }
                </ul>
                <div className="submit">确认</div>
                <div className="answer">答案：<strong>{obj.answer}</strong></div>
                <div className="analysis">解析：<span>{obj.analysis}</span></div>
            </div>
        )
    }
}
